using UnityEngine;
using System.Collections;

public class InstanciarCaixas : MonoBehaviour {

	public static float timer;
	public Transform box;
	public InstantiatePlatform inst;
	public static int caixas;
	
	void Update()
	{
		timer += Time.deltaTime;
		if(timer>Random.Range(1.0f,3.0f) && caixas < 10)
		{
			Instantiate(box,new Vector3(inst.lastPlatform.transform.position.x + (Random.Range(4.0f,8.0f)),inst.lastPlatform.transform.position.y+1f,inst.lastPlatform.transform.position.z),Quaternion.identity);
			caixas ++;
			timer = 0;
		}
	}
}
